<?php
namespace Home\Controller;
use Home\Common\Common;
class MyController extends Common {
   public function edit(){
       if (empty($_POST['submit'])){

           $admin = M('staffinfo');
           $info = $admin->where('`stf_id`='.$_SESSION['aid'])->find();
           $this->assign('info',$info);
           $this->display();
       }else{
           if($_POST['stf_pwd']!=$_POST['pwd1']){
               
               $this->error('修改失败！两次密码不一致！',U('edit'));
           }else{

               $_POST['stf_pwd']=md5($_POST['stf_pwd']);
               $staff = D('staffinfo');
               $staff->where('`stf_id`='.$_SESSION['aid'])->save($_POST);
               $this->success('修改成功!',U('edit'));
           }

       }

   }
}